#ifndef UPDATER_TYPES
#define UPDATER_TYPES
#include <sys/types.h>

/* Types. */
/* Abstracts types from hardware */

/* char - 1 byte */
typedef char CHAR;
typedef unsigned char UCHAR;

/* short - 2 bytes */
typedef short SHORT;
typedef unsigned short USHORT;

/* int - 4 byted */
typedef int INT;
typedef unsigned int UINT;

/* float - 4 bytes */
typedef float FLOAT;

/* double - 8 byted */
typedef double DOUBLE;

/* long */
typedef long LONG;
typedef unsigned long ULONG;

/* 16 bytes */
typedef long double LONGDOUBLE;

typedef void VOID;

#ifndef NULL
#define NULL ((void *) 0)
#endif

typedef size_t SIZE_T;

typedef off_t OFF_T;

typedef mode_t MODE_T;

typedef time_t TYME_T;

typedef uid_t UID_T;

typedef time_t TIME_T;

/* size of array to save whole package checksum in */
#define MD5LEN  16

/* File descriptor abstraction */
struct file_desc_struct
{
	INT fd; /* Real file descriptor*/
};

typedef struct file_desc_struct FD_T;

struct stat_struct
{
    char * stat;
};

typedef struct stat_struct STAT_T;


#endif /* UPDATER_TYPES */

/* Redefinition of open flags  */

#define W_O_RDONLY	        0000
#define W_O_WRONLY	        0001
#define W_O_RDWR		    0002
#define W_O_ACCMODE	        0003
#define W_O_CREAT		    0100	/* not fcntl */
#define W_O_EXCL		    0200	/* not fcntl */
#define W_O_NOCTTY	        0400	/* not fcntl */
#define W_O_TRUNC		    01000	/* not fcntl */
#define W_O_APPEND	        02000
#define W_O_NONBLOCK	    04000
#define W_O_NDELAY	        O_NONBLOCK
#define W_O_SYNC		    010000
#define W_O_FSYNC		    O_SYNC
#define W_O_ASYNC		    020000

/* Redefine lseek's defines */


#define W_SEEK_SET	0	/* Seek from beginning of file.  */
#define W_SEEK_CUR	1	/* Seek from current position.  */
#define W_SEEK_END	2	/* Seek from end of file.  */

/* Redefinition for the st_mode field of stat struct */

#define W_S_IFMT     0170000   /* bit mask for the file type bit fields */
#define W_S_IFSOCK   0140000   /* socket */
#define W_S_IFLNK    0120000   /* symbolic link */
#define W_S_IFREG    0100000   /* regular file */
#define W_S_IFBLK    0060000   /* block device */
#define W_S_IFDIR    0040000   /* directory */
#define W_S_IFCHR    0020000   /* character device */
#define W_S_IFIFO    0010000   /* FIFO */
#define W_S_ISUID    0004000   /* set UID bit */
#define W_S_ISGID    0002000   /* set-group-ID bit (see below) */
#define W_S_ISVTX    0001000   /* sticky bit (see below) */
#define W_S_IRWXU    00700     /* mask for file owner permissions */
#define W_S_IRUSR    00400     /* owner has read permission */
#define W_S_IWUSR    00200     /* owner has write permission */
#define W_S_IXUSR    00100     /* owner has execute permission */
#define W_S_IRWXG    00070     /* mask for group permissions */
#define W_S_IRGRP    00040     /* group has read permission */
#define W_S_IWGRP    00020     /* group has write permission */
#define W_S_IXGRP    00010     /* group has execute permission */
#define W_S_IRWXO    00007     /* mask for permissions for others (not in group) */
#define W_S_IROTH    00004     /* others have read permission */
#define W_S_IWOTH    00002     /* others have write permission */
#define W_S_IXOTH    00001     /* others have execute permission */

